#!/bin/bash
# 数据流追踪演示脚本

echo "🔄 Agent数据流追踪演示"
echo "========================"

# 启动所有Agent服务
echo "📡 启动Agent服务..."
python -m uvicorn web_backend:app --host 0.0.0.0 --port 8000 &
WEB_PID=$!

python intelligent_weather_agent.py &
WEATHER_PID=$!

python budget_agent.py &
BUDGET_PID=$!

python travel_agent.py &
TRAVEL_PID=$!

python restaurant_agent.py &
RESTAURANT_PID=$!

python coordinator_agent.py &
COORDINATOR_PID=$!

echo "⏳ 等待服务启动..."
sleep 5

echo "🧪 发送测试请求..."
curl -X POST "http://localhost:8000/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "我想去北京旅行3天，预算800欧元，喜欢历史景点和美食，对天气比较敏感",
    "user_id": "test_user"
  }' | jq .

echo ""
echo "📊 查看数据流日志..."
echo "======================"
if [ -f "data_flow.log" ]; then
    echo "数据流日志内容："
    cat data_flow.log | tail -20
else
    echo "数据流日志文件不存在"
fi

echo ""
echo "🧹 清理进程..."
kill $WEB_PID $WEATHER_PID $BUDGET_PID $TRAVEL_PID $RESTAURANT_PID $COORDINATOR_PID 2>/dev/null

echo "✅ 演示完成"
